﻿CREATE TABLE [dbo].[SponsorTypeAllowedParent] (

	[Id] [dbo].[Id] NOT NULL  IDENTITY(1000000000, 1), 

	[SponsorTypeId] [dbo].[Id] NOT NULL,

	[ParentSponsorTypeId] [dbo].[Id] NULL,
  
    [CreateId] [dbo].[Name] NOT NULL DEFAULT SUSER_NAME () , 

    [CreateDateTime] [dbo].[CreateModifiedDateTime] NOT NULL DEFAULT GETDATE() , 

    [ModifiedId] [dbo].[Name] NOT NULL DEFAULT SUSER_NAME (),

    [ModifiedDateTime] [dbo].[CreateModifiedDateTime] NOT NULL DEFAULT GETDATE(), 
 
    CONSTRAINT [PK_SponsorTypeAllowedParent] PRIMARY KEY ([Id]), 

	CONSTRAINT [UNQ_SponsorTypeAllowedParent_SponsorTypeIdParentSponsorTypeId] UNIQUE (SponsorTypeId, ParentSponsorTypeId),

	CONSTRAINT [FK_SponsorTypeAllowedParent_SponsorTypeId] FOREIGN KEY (SponsorTypeId) REFERENCES SponsorType (Id),

	CONSTRAINT [FK_SponsorTypeAllowedParent_ParentSponsorTypeId] FOREIGN KEY (ParentSponsorTypeId) References SponsorType (Id)

)
